/**
	@file
	Functions for debugging.
	@todo Replace #include <stdio.h> with io.h (when moved from VS)
	@author Konstantin Kastanov
*/
#include "headers/debugging.h"
#include "headers/dataTypes.h"
#include <stdio.h> //Replace with io.h

/**
	Prints dump of the specified memory buffer. (table with 16 hex numbers in each row)
	@param data Pointer to memory
	@param count Number of bytes to include into dump
	
	@note Relies on \ref printf()
	@todo Add ASCII values display.
*/
void printDump(u8int *data, u32int count)
{
	u32int row = 0, col = 0, i = 0, printed = 0;
	
	//Print top labels
	printf("\n\t");
	for(i = 0; i < 16; i++)
	{
		printf("%X  ", i);
	}
	printf("\n\n");

	for(row = 0; printed < count; row++)
	{
		printf("%X\t", row);
		for(col = 0; (col < 16) && (printed < count); col++)
		{
			printf("%X%X ", ((data[printed] & 0xF0) >> 4) , data[printed] & 0xF);
			printed++;
		}
		printf("\n");
	}
}